package com.notary.controller;

import com.alibaba.fastjson.JSONObject;
import com.notary.entity.ExecuteSent;
import com.notary.entity.NotaryTemplate;
import com.notary.entity.vo.JsonResult;
import com.notary.service.ContractExecuteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "卷宗申请执行控制器")
@RestController()
@RequestMapping("/contractExecute")
public class ContractExecuteController {

    @Resource
    private ContractExecuteService contractExecuteService;

    /*
    *  @Author: Tokgo
    *  @Desc: 申请执行
    * */
    @ApiOperation("申请执行")
    @PostMapping("/applyExecute")
    public JsonResult applyExecute(@RequestBody JSONObject jsonObject) {
        return contractExecuteService.applyExecute(jsonObject);
    }

    /*
     *  @Author: Tokgo
     *  @Desc: 驳回申请
     * */
    @ApiOperation("申请执行-驳回（不予受理）")
    @PostMapping("/rejectExecute")
    public JsonResult rejectExecute(@RequestBody JSONObject jsonObject) {
        return contractExecuteService.rejectExecute(jsonObject.getString("notaryNo"), jsonObject.getString("reason"));
    }

    @ApiOperation("申请电子公证")
    @PostMapping("/applyDepositNotaryBook")
    public JsonResult applyDepositNotaryBook(@RequestBody JSONObject jsonObject) {
        return contractExecuteService.applyDepositNotaryBook(jsonObject);
    }

    @ApiOperation("查看存证")
    @PostMapping("/viewDeposit")
    public JsonResult viewDeposit(@RequestBody JSONObject jsonObject) {
        return contractExecuteService.viewDeposit(jsonObject);
    }

    @ApiOperation("执行文件送")
    @PostMapping("/executeSent")
    public JsonResult executeSent(@RequestBody JSONObject jsonObject) {
        return contractExecuteService.executeSent(jsonObject);
    }

    @ApiOperation("赋强执行文件送达记录")
    @PostMapping("/getExecuteSent")
    public JsonResult getExecuteSent(@RequestBody JSONObject jsonObject) {
        return contractExecuteService.getExecuteSent(jsonObject.getString("notaryNo"));
    }


}
